<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/WEB-INF/jspf/meta/meta.jspf" %>
    <title>科目管理</title>
    <%@include file="/WEB-INF/jspf/adminPage.jspf" %>
    <script type="text/javascript" src="<%=request.getContextPath()%>/static/subject/subjectAdd.js"></script>
</head>

<script type="text/javascript">
    $(function () {
    })
</script>
<body>
<%--	<div style="margin: 20px 0;"></div>--%>
<%--		<div style="padding: 10px 60px 20px 60px">--%>
<form id="ff" method="post">
    <table>
        <tr>
            <td>科目名:</td>
            <td><input class="easyui-textbox" type="text"
                       name="subjectName" data-options="required:true"></input></td>
        </tr>
        <tr>
            <td>备注:</td>
            <td><input class="easyui-textbox" type="text"
                       name="subjectInfo" data-options="multiline:true"
                       style="height: 60px"></input></td>
        </tr>
    </table>
</form>
<div>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清空</a>
</div>
<%--		</div>--%>
<script>
    function submitForm() {
        $('#ff').form({
            url: '<%=request.getContextPath()%>/subject/subjectAdd.json',
            onSubmit: function () {
                return $(this).form('enableValidation').form('validate');
            },
            success: function (data) {
                var d = JSON.parse(data);
                //假如后台删除成功
                $.messager.show({
                    title: '操作提示',
                    msg: d.msg,
                    timeout: 3000,
                    showType: 'slide'
                });
                if (d.code == '1') {
                    $('#ff').form('clear');
                }
            }
        });
        $('#ff').submit();
    }

    function clearForm() {
        $('#ff').form('clear');
    }
</script>
</body>
</html>